Spring Boot 3.0 Cookbook: Proven Recipes for Building Modern and Robust Java Web Applications With Spring Boot by Felip Miguel Puig

Spring Boot 3.0 Cookbook: Proven Recipes for Building Modern and Robust Java Web Applications With Spring Boot by Felip Miguel Puig

Author:Felip Miguel Puig [Puig, Felip Miguel]
Language: eng
Format: epub
Tags: Computers, Languages, Java, Internet, Web Programming, Web Services & APIs
ISBN: 9781835084908
Google: F_AOEQAAQBAJ
Publisher: Packt Publishing Ltd
Published: 2024-07-11T22:00:00+00:00


Figure 5.3: List of tables in recently in the database created by Flyway.

The database now has the tables necessary to manage our application.

Let’s create a migration for our application now. We need to manage football matches in our application, and we need to know the height and weight of the players.The matches will be managed in a new Entity named MatchEntity. It will have two fields referencing the teams playing the match, the match date, and the goals scored by each team. It should look like this: @Entity @Table(name = "matches") public class MatchEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Integer id; private LocalDate matchDate; @ManyToOne @JoinColumn(name = "team1_id", nullable = false) private TeamEntity team1; @ManyToOne @JoinColumn(name = "team2_id", nullable = false) private TeamEntity team2; @Column(name = "team1_goals", columnDefinition = "integer default 0") private Integer team1Goals; @Column(name = "team2_goals", columnDefinition = "integer default 0") private Integer team2Goals; }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.